<template>
  <div>
    <DecorativeTitle text="车组" />
    <div id="carUnit" class="d-flex pt-3 px-2" style="align-items: center;">
      <div style="width: 220px;height: 180px;" class="car-info-list">
        <div class="info-item" @click="handleItemClick('dutyCarUnit')">
          <span class="info-label">值班车组</span>
          <span class="info-value">96个</span>
        </div>
        <div class="info-item" @click="handleItemClick('taskCarUnit')">
          <span class="info-label">任务车组</span>
          <span class="info-value">36个</span>
        </div>
        <div class="info-item" @click="handleItemClick('standByUnit')">
          <span class="info-label">待命车组</span>
          <span class="info-value">58个</span>
        </div>
        <div class="info-item" @click="handleItemClick('stopUsedUnit')">
          <span class="info-label">暂停调用</span>
          <span class="info-value">2个</span>
        </div>
      </div>
      <Chart :cdata="cdata" />
    </div>
  </div>
</template>

<script>
import Chart from './chart.vue';
import DecorativeTitle from "_c/DecorativeTitle.vue";
export default {
  data () {
    return {
      cdata: {
        categories: ['医生', '护士', '驾驶员', '担架员'],
        total: [1217, 1178, 842, 301],
        onDuty: [71, 76, 96, 27]
      }
    }
  },
  components: {
    DecorativeTitle,
    Chart,
  },
  mounted () {
  },
  methods: {
    handleItemClick(mode) {
      var data = { mode: mode };
      this.$store.dispatch('popup/openPopup', { componentName: 'CarUnitStats', data: data });
    }
  }
}
</script>

<style lang="scss" scoped>
.car-info-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px; /* 各条目之间的间距 */
  padding: 0 15px;
  padding-right: 40px;
  box-sizing: border-box;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e0e0e0;
  cursor: pointer;

  &:last-child {
    border-bottom: none;
  }
}

.info-label {
  font-size: 14px;
}

.info-value {
  color: #3DE7C9;
  font-size: 14px;
  font-weight: 500;
}
</style>
